/*
 * Records Package
 */
package edu.gatech.oad.records;
import edu.gatech.oad.doctorsorder.LabOrder;
import edu.gatech.oad.persistence.PersistentObject;;
/**
 * Stores the results of a lab
 *@author Nathan Hurley
 *@version 1.0 3/6/11
 */
public class LabResults extends PersistentObject{
	/**
	 * Serializable variable
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * Represents the results of the lab
	 */
	private String results;
	
	/**
	 * The LabOrder used to create the Lab
	 */
	private LabOrder order;
	
	/**
	 * Constructs a LabResults object given a
	 * @param results  the results of the lab
	 * @param order the LabOrder used to create the Lab
	 */
	public LabResults(String results, LabOrder order){
		this.results = results;
		this.order = order;
	}
	
	/**
	 * @param results  the new results
	 */
	public void setResults(String results){
		this.results = results;
	}
	
	/**
	 * @return  the lab results
	 */
	public String getResults(){
		return results;
	}
	
	/**
	 * @return  the current LabOrder
	 */
	public LabOrder getOrder(){
		return order;
	}
	
	/**
	 * @param order  the new LabOrder
	 */
	public void setOrder(LabOrder order){
		this.order = order;
	}
	
	/**
	 * @return  the labs name
	 */
	public String toString(){
		return order.getName();
	}
	
	/**
	 * @param o the Object to compare this to
	 * @return true if the results and the order are equal and false otherwise
	 */
	public boolean equals(Object o){
		if(this == o){
			return true;
		}
		if(o instanceof LabResults){
			final LabResults s = (LabResults) o;
			if(s.getResults().equals(this.getResults()) && 
					s.getOrder().equals(this.getOrder())){
				return true;
			}
		}
		return false;
	}
	
	/**
	 * @return the hashcode for the LabResults
	 */
	public int hashCode(){
		return this.hashCode();
	}
}
